<html>
<body>
<div onclick="clickme(this)">Mouse over me</div>
<script>
function clickme(obj){
	console.log(obj.innerHTML);
	if (obj.innerHTML.search(/mouse/i) >=0) {
		obj.innerHTML = "Thank you";
		console.log('matched');
	}else{
		console.log('not matched');
		obj.innerHTML = 'Mouse over me';
	}
};
</script>
</body>
</html>